% Funcion g
function ans = g(method, x, beta)
    switch(method)
	case 1
	    ans = x;
	case 2
	    ans = tanh(beta*x);
	case 3
	    ans = 1.0./(1.0+exp(-2*beta*x));
	case 4
	    ans = sign(x);
    endswitch

endfunction
